package com.ztc.ZtcCar.service;

import com.aqgj.util.Pager;
import com.ztc.ZtcCar.bean.ZtcCar;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ztc.ZtcCar.dao.ZtcCarDao;

import java.util.List;

@Service("ZtcCar")
public class ZtcCarManager {
    @Autowired
    ZtcCarDao ztcCarDao;


    public String save(ZtcCar ztcCar) {
        return ztcCarDao.save(ztcCar);
    }

    /**
     * 根据公司id获取车信息.
     * @param transportId    车方公司id
     * @param pageSize       每页大小
     * @param pageNumber     页码
     * @param transportType  公司类型
     * @return
     */
    public Pager<ZtcCar>  getZtcCarByTransportId(String transportId, Integer pageSize, Integer pageNumber, Integer transportType,String search) {
        return ztcCarDao.getCarListByTransportId(transportId, pageSize, pageNumber, transportType,search);
    }

    public void removeById(String carId) {
        ztcCarDao.removeById(carId);
    }

    public ZtcCar findUniqueBy(String propertyName, Object value) {
        return ztcCarDao.findUniqueBy(propertyName, value);
    }

    public List<ZtcCar> findBy(String propertyName1, Object value1, String propertyName2, Object value2) {
        return ztcCarDao.findBy(propertyName1, value1, propertyName2, value2);
    }

    public List<ZtcCar> findBy(String propertyName, Object value) {
        return ztcCarDao.findBy(propertyName, value);
    }

    public ZtcCar get(String zid) { return ztcCarDao.get(zid); }

    /**
     * 根据公司id获取车.
     * @param transportId 公司id
     * @param isReviewed  是否审核
     * @return 车信息
     */
    public Pager<ZtcCar> getZtcCarByIdAndReviewed(String transportId, boolean isReviewed,Integer pageSize,Integer pageNumber,String search,Integer type) {
        return ztcCarDao.getZtcCarByIdAndReviewed(transportId,isReviewed,pageSize,pageNumber,search,type);
    }

    public String update(ZtcCar ztcCar) {
        return ztcCarDao.update(ztcCar);
    }

    public List<ZtcCar> getZtcCarByTransportId(String transportId,Integer type) {
        return ztcCarDao.getCarListByTransportId(transportId,type);
    }
}
